<div id="content-wrapper" class="corner">
<?php slot('title',sprintf('CorpPon - Admin Products'))?>
<h1>Products List <a href="<?php echo url_for('products/new') ?>">| New</a></h1>
<?php foreach ($products as $product): ?>
<span class="list-item">
  <span class="image-admin-list">
    <a href="<?php echo url_for('products/show?id_product='.$product->getIdProduct()) ?>">
      <img name="product_list" name="product_list"src="/uploads/products/list/<?php echo $product->getPhoto1() ?>" />
    </a>
  </span>
  <span class="titulo-item-admin-list">
    <a href="<?php echo url_for('products/show?id_product='.$product->getIdProduct()) ?>">
      <?php echo $product->getName() ?> - <?php echo $product->Account->getCompanyName() ?>
    </a>
      <br />Price: <span class="result">$<?php echo $product->getDiscountedPrice() ?></span>
      <br />
      Discount: <span class="result"><?php echo number_format($product->getDiscount(),0); ?>%</span>
      <br />Date: <span class="result"><?php echo $product->getStartDate() ?> until <?php echo $product->getEndDate() ?></span>
  </span>

</span>

<table style="display:none;">
  <thead>
    <tr>
      <th>Id product</th>
      <th>Name</th>
      <th>Status</th>
      <th>Highlight</th>
      <th>Price</th>
      <th>Discount</th>
      <th>Photo1</th>
      <th>Start date</th>
      <th>End date</th>
    </tr>
  </thead>
  <tbody>
    
    <tr>
      <td><?php echo $product->getIdProduct() ?></td>
      <td></td>
      <td><?php echo $product->getStatus() ?></td>
      <td><?php echo $product->getHighlight() ?></td>
      <td><?php echo $product->getPrice() ?></td>
      <td><?php echo $product->getDiscount() ?></td>
      <td>
     
      </td>
      <td><?php echo $product->getStartDate() ?></td>
      <td><?php echo $product->getEndDate() ?></td>
    </tr>
   
  </tbody>
</table>
 <?php endforeach; ?>
<div class="pagination">
<?php if ($pager->haveToPaginate()): ?>
  <span><?php echo 'Showing from '.$pager->getFirstIndice().' to '.$pager->getLastIndice().' of '.$pager->count().' products'; ?></span><br/>
  <?php if (!$pager->isFirstPage()) :  ?>
  <a href="<?php echo url_for('products/productsAdmin') ?>"><?php echo 'First' ?></a>

  <a href="<?php echo url_for('products/productsAdmin') ?>?page=<?php echo $pager->getPreviousPage() ?>"><?php echo 'Previous' ?></a>
  <?php endif; ?>

  <?php foreach ($pager->getLinks() as $page): ?>
    <?php if ($page == $pager->getPage()): ?>
      <?php echo $page ?>
    <?php else: ?>
      <a href="<?php echo url_for('products/productsAdmin') ?>?page=<?php echo $page ?>"><?php echo $page ?></a>
    <?php endif; ?>
  <?php endforeach; ?>

  <?php if (!$pager->isLastPage()) :  ?>
  <a href="<?php echo url_for('products/productsAdmin') ?>?page=<?php echo $pager->getNextPage() ?>"> <?php echo 'Next' ?></a>

  <a href="<?php echo url_for('products/productsAdmin') ?>?page=<?php echo $pager->getLastPage() ?>"><?php echo 'Last' ?></a>
  <?php endif; ?>

<?php endif; ?>
</div>
</div>
  
